home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
W95 Shareware Collection
/
W95 Collection - Windows 95 Shareware (LCDCAN).iso
/
win95
/
utils
/
chief200
/
chiefpro.chf
< prev
next >
Wrap
Text File
|
1995-09-15
|
6KB
|
155 lines
REM ROUGH AND READY SAMPLE CHIEFPRO BATCH FILE
REM TRIES TO USE A LOT OF THE BATCH LANGUAGE FEATURES!!
REM ---------------------------------------------------
REM --- ERRORCODE 0 means success
REM --- ERRORCODE 1 means a syntax error
REM --- ERRORCODE -1 means some other processing error
REM --- First, let's define some constants for use later on
#CONST T_FILE=$DEST\CHFTEST.TXT
#CONST Question1="Should I run NOTEPAD?"
#CONST Question2="Should I abort this Batch Demo now?"
#CONST Question3="Do you want to see a test run of a sample\nChief Pro batch file?"
#CONST Question4="Do you want to see a modeless dialog box\nfor continuous messages?"
#CONST Prompt1="Please Enter a parameter for Windows WRITE:\nor, Click on Cancel to skip this:"
REM --- ask user for confirmation
REM IF NOT-CONFIRM "Do you want to see a test run of a sample\nChief Pro batch file ?" GOTO NO-DEMO
REM IF NOT-CONFIRM "Do you want to see a modeless dialog box\nfor continuous messages ?" GOTO THE-REST
IF NOT-CONFIRM Question3 GOTO NO-DEMO
IF NOT-CONFIRM Question4 GOTO THE-REST
:SHOW-DIALOG
REM - display a message on a modeless dialog
SAY You will now see a modeless message dialog ...
DISPLAY Writing to T_FILE Please wait ...
DELAY 4
REM --- create the file; do this if you want uninstaller to be able to
REM --- to remove it later on, else, it is not necessary to use CREATEFILE
IF NOT-EXIST T_FILE CREATEFILE T_FILE
IF ERRORCODE -1 GOTO THE-REST
REM --- remove READONLY file attribute
ATTRIB T_FILE;-R
IF ERRORCODE -1 GOTO THE-REST
REM --- write entries into the file
APPENDFILE T_FILE REM ------------------- entry by ChiefPro -----------------
IF ERRORCODE -1 SAY I could not write the entry!
APPENDFILE T_FILE Ok then. Let us see what we all can do!
IF ERRORCODE -1 SAY I could not write the entry!
WRITETEXT T_FILE;1;This is the first line
IF ERRORCODE -1 SAY I could not write the entry!
WRITETEXT T_FILE;last;This is the last line
IF ERRORCODE -1 SAY I could not write the entry!
WRITETEXT T_FILE;4;This is the 4th line
IF ERRORCODE -1 SAY I could not write the entry!
WRITETEXT T_FILE;155;This is the real last (or 155th) line
IF ERRORCODE -1 SAY I could not write the entry!
REM --- set the HIDDEN and READONLY file attribute bits
ATTRIB T_FILE;+H;+R
IF ERRORCODE 0 SAY I have now set T_FILE attibute bits \nto READONLY and HIDDEN
REM - turn off the display dialog
DISPLAY OFF
SAY The display dialog has now been turned off!
REM turn on the display dialog again ....
DISPLAY The display dialog is on again!\n\nPlease wait, I am still working hard ...
REM --- remove READONLY, HIDDEN, and ARCHIVE file attribute bits
ATTRIB T_FILE;-R;-H;-A
IF ERRORCODE 0 SAY I have now removed the READONLY and HIDDEN \nattribute bits from T_FILE
:THE-REST
REM ---- make a directory, et. al.
MD $TEMPDIR\CHIEFPRO
IF ERRORCODE 0 COPY $DEST\SAMPLES\CHIEFPRO.CHF $TEMPDIR\CHIEFPRO
IF ERRORCODE 0 SAY I copied the test file!
IF EXIST $TEMPDIR\CHIEFPRO\*.CHF SAY The test file IS there!
IF EXIST $TEMPDIR\CHIEFPRO\*.CHF DEL $TEMPDIR\CHIEFPRO\CHIEFPRO.CHF
IF ERRORCODE 0 SAY I Deleted the test file!
IF ISDIRECTORY $TEMPDIR\CHIEFPRO RD $TEMPDIR\CHIEFPRO
IF ERRORCODE 0 SAY I Deleted the test directory!
REM --- ask for user INPUT
REM IF INPUT "Please Enter a parameter for Windows WRITE\nOr, Click on Cancel" EXECWAIT WRITE.EXE INPUT
IF INPUT Prompt1 EXECWAIT WRITE.EXE INPUT
REM --- ask user for confirmation
REM IF CONFIRM "Should I RUN Notepad?" EXECWAIT notepad
IF CONFIRM Question1 EXECWAIT notepad
REM --- various Video display modes, et. al.
IF VMODE VGA ECHO Your video display driver is VGA!
IF VMODE SVGA ECHO Your video display driver is SuperVGA!
IF VMODE SSVGA ECHO Your video display driver is \n1024 * 768 or higher!
REM --- Various Windows versions, et. al.
IF WINVER 3.10 SAY Your Windows Version is 3.10
IF WINVER 3.11 SAY Your Windows Version is 3.11 \n(no network)
IF WINVER NT SAY Your Windows Version is Windows NT
IF WINVER 95 SAY Your Windows Version is Windows 95
REM - using numeric codes [1 to 11]
IF WINVER 1 SAY Your Windows Version is 3.00
IF WINVER 2 SAY Your Windows Version is 3.10 \n(no network)
IF WINVER 3 SAY Your Windows Version is 3.10 \n(with network)
IF WINVER 4 SAY Your Windows Version is 3.10 \n(with Win32s, no network)
IF WINVER 5 SAY Your Windows Version is 3.10 \n(with Win32s, and network)
IF WINVER 6 SAY Your Windows Version is 3.11 \n(no network)
IF WINVER 7 SAY Your Windows Version is 3.11WG \n(with Network)
IF WINVER 8 SAY Your Windows Version is 3.11 \nwith Win32s
IF WINVER 9 SAY Your Windows Version is 3.11 \n(with network and Win32s)
IF WINVER 10 SAY Your Windows Version is Windows 95
IF WINVER 11 SAY Your Windows Version is Windows NT
REM - using generic values for Windows versions
IF WIN16 SAY You are running a 16-bit version of Windows.\nYou can only run 16-bit programs.
IF WFWG SAY You are running Windows for Workgroups
IF WIN32S SAY Your Windows version can run Win32s programs
IF WIN32 SAY You are running a 32-bit version of Windows
IF CPU 80386 say Your PC has got an 80386 chip
IF CPU 80486 say Your PC has got an 80486 chip
IF CPU P5 say Your PC has got a Pentium chip
IF HAS-FPU say Your PC has got a Maths Co-Processor
REM --- are we fed up with this batch demo?
IF CONFIRM Question2 EXIT
REM --- sundry matters, et. al.
ECHO Source directory is $SOURCEDIR
ECHO Target directory is $DEST
ECHO Windows directory is $WINDIR
ECHO System directory is $SYSDIR
ECHO Temp directory is $TEMPDIR
REM --- more stuff
IF INPUT "Delay how many seconds?" DELAY INPUT
REM --- disk space matters, et. al.
IF DISKFREE > 100000 SAY Free Space is Greater than 100kb!
IF DISKFREE < 100000000 SAY Free Space is less than 100MB!
IF DISKFREE > 100000000 SAY Free Space is Greater than 100MB!
IF DISKFREE < 100000 SAY Free Space is Less than 100kb!
EXIT
[----- we came here because you didn't want the demo ------]
:NO-DEMO
SAY Well, sorry that you don't want to see my demo.\n\nThis batch file is called CHIEFPRO.CHF.\n\nYou can check it later on.\n\nBye for now ...
EXIT
REM - always end a label with EXIT IF you want processing
REM - to end there!
[--------------------------------------]
REM IF CONFIRM "Should I now exit windows?" EXITWINDOWS
REM IF INPUT "Exit Windows and run what?" EXITWINDOWSEXEC INPUT